//package com.example.springboot01.controller;
//
//import com.example.springboot01.config.ResultMsg;
//import com.example.springboot01.config.ResultStatusEnum;
//import com.example.springboot01.model.Student;
//import com.example.springboot01.model.Teacher;
//import com.example.springboot01.service.IStudentService;
//import org.apache.commons.lang3.exception.ExceptionUtils;
//import org.apache.ibatis.annotations.Results;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @Auther: zrd
// * @Date: 2022/5/4/05/04/10:49
// * @Description: com.example.springboot01.controller
// */
////1.注入水平boot IOC容器
////2.以Json、XML等字符串形式返回
//@RestController
////指定类的整体URPL访问路径
//@RequestMapping("/student")
//public class StudentController {
//    @Autowired
//    private IStudentService iStudentService;
//    private Logger logger = LoggerFactory.getLogger(getClass());
//    //等价于RequestMapping(value = "/{id}",
//    //method = RequestMethod.GET)
//    @GetMapping("/{id}")
//    public Student get(@PathVariable Integer id) {
//
//        try {
//            Student student = iStudentService.get(id);
//            if (student == null) {
//                return ResultMsg.error(ResultStatusEnum.SELECT_ERROR, "无此对象");
//            }
//            return ResultMsg.ok(ResultStatusEnum.SELECT_SUCCESS,student);
//        } catch (Exception e) {
//            logger.trace(e.getMessage());
//            logger.debug(e.getMessage());
//            logger.info(e.getMessage());
//            logger.warn(e.getMessage());
//            logger.error(ExceptionUtils.getStackTrace(e));
//            return ResultMsg.error(ResultStatusEnum.SELECT_ERROR);
//        }
//    }
//}
